﻿'use strict';
app
    // Login Box controller 
    .controller('ReferralController', [
        '$rootScope', '$scope', '$http', '$stateParams', '$state', '$localStorage', function ($rootScope, $scope, $http, $stateParams, $state, $localStorage) {

            console.log($stateParams)
            //console.log($localStorage.user);
            //$localStorage.user
       
            $http.post($rootScope.APIUrl + 'GetReferral', { UserId: $stateParams.UserId }).then(function successCallback(resp) {
                $scope.referrallists = resp.data;
            })
            $scope.showup = $localStorage.user.UserId != $stateParams.UserId ? true : false;
            $http.post($rootScope.APIUrl + 'GetParent', { UserId: $stateParams.UserId }).then(function successCallback(resp) {

                $scope.IDParent = resp.data.Parent_ID;
            })
            $scope.doRefresh = function () {
                $state.reload();
                $scope.$broadcast('scroll.refreshComplete');
                $scope.$apply()
            };
        }

    ])

